/*
 *  infraredSensor.cpp
 *  project8
 *
 *  Created by Luca Gobbo on 21-06-10.
 *  Copyright 2010 __MyCompanyName__. All rights reserved.
 *
 */

#include "InfraredSensor.h"
#define HEARTBEAT mkt_pin_read(7)

InfraredSensor::InfraredSensor(){
    mkt_pin_direction(7, mkt_input);
    std::cout << "set direction pin 7";
    
}

int InfraredSensor::heartBeat(){
  
    if( HEARTBEAT) {
                       
     	  int lastState = this->state;
     	  this->state = 1;
        return lastState == 0 ;
    }        else this->state=0;
     
    return 0;
    
}

IRSListener *  InfraredSensor::getListener(){
  
    
    return listener;
}


void InfraredSensor::setListener(IRSListener * l){ 

 
  listener = l;
}